#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=305,mo=1e9+7;
int n,m,A[N][N];
char s[N][N];
int main()
{
	freopen("disanti.in","r",stdin);
	freopen("disanti.out","w",stdout);
	scanf("%d%d",&n,&m);
	for(int a=1;a<=n;a++)
	{
		scanf("%s",s[a]+1);
		for(int b=1;b<=m;b++) A[a][b]=s[a][b]-'0';
	}
	for(int i=1;i<=m;i++)
	{
	//	cout<<A[1][i]<<endl;
		A[1][i]^=1;
		int ans=1;
		for(int a=1;a<=m;a++)
		{
			int r;
			for(int b=a;b<=m;b++)
			{
				if(A[1][b]==A[1][a]) r=b;
				else break;
			}
			for(int b=1;b<r-a+1;b++)
			{
				ans=ans*2%mo;
			}
			a=r;
		}
		A[1][i]^=1;
		printf("%d ",ans);
	}
}
